package com.zxc.controller;

import com.zxc.entity.SysUser;
import com.zxc.service.CstCustomerService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Controller
public class FirstController {

    @RequestMapping(value = "/")
    public String first(HttpSession session){
        Subject subject = SecurityUtils.getSubject();
        Map map = (Map) subject.getPrincipal();
        SysUser sysUser = (SysUser) map.get("sysUser");
        List<Map> menuList = (List<Map>) map.get("menuList");
        String sysUserRole = (String) map.get("sysUserRole");

        session.setAttribute("menuList",menuList);
        session.setAttribute("sysUser",sysUser);
        session.setAttribute("sysUserRole",sysUserRole);

        return "workbench/main";
    }

}
